import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { Server } from 'node:http'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      'common': fileURLToPath(new URL('./src/common', import.meta.url))
    }
  },
  Server: {
    Proxy: {
      '/api' : {
        target : 'http://localhost:5173',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/,'')

      }
    },
  }
})
